package com.tbit.uqbike.client.constant;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

/**
 * @Author: chen
 * @Description: 系统配置
 * @Date: 创建于 16:01 2020/5/14
 */
@Component
@RefreshScope
public class SystemConstant {

    public static String virtual;

    public static String operaPsw;

    public static String angleNum;

    /**
     * 蓝牙连接加密key
     */
    public static String BLE_KEY;
    /**
     * 推送开关
     */
    public static String PUSH_BUTTON;

    public static String PUSH_URL;

    public static String FACE_URL;

    public static String PHOTO_PATH;

    /**
     * Google Authenticator 密钥secretKey
     */
    public static String SUPER_PASSWORD_AUTH_SECRET;
    /**
     * Google Authenticator 口令位数
     */
    public static String SUPER_PASSWORD_AUTH_DIGITS;
    /**
     * Google Authenticator 口令有效期(单位：秒)
     */
    public static String SUPER_PASSWORD_AUTH_EXPIRE;
    /**
     * 发送手机验证码位数
     */
    public static Integer AUTH_CODE_LENGTH;
    /**
     * 发送手机验证码的有效期 (单位：秒)
     */
    public static Integer AUTH_CODE_VALIDITY;
    /**
     * Google Authenticator 密钥secretKey 第二种
     */
    public static String SUPER_PASSWORD_AUTH_SECRET_PLUS;
    /**
     * Google Authenticator 口令位数 第二种
     */
    public static String SUPER_PASSWORD_AUTH_DIGITS_PLUS;
    /**
     * Google Authenticator 口令有效期(单位：秒) 第二种
     */
    public static String SUPER_PASSWORD_AUTH_EXPIRE_PLUS;

    /**
     * maas检验的秘钥
     */
    public static String MAAS_SECRET = "";
    /**
     * 借车开关
     */
    public static Boolean borrow_button;
    /**
     * 登录开关
     */
    public static Boolean login_button;
    /**
     * sls前缀
     */
    public static String ENDPOINT;
    /**
     * sls的accessKeyId
     */
    public static String ACCESSKEYID;
    /**
     * sls的accessKeySecret
     */
    public static String ACCESSKEYSECRET;

    /**
     * 分账服务基础域名
     */
    public static String CASH_SERVICE_URL;

    /**
     * 活体实体桶
     */
    public static String FACEBUCKETNAME;

    /**
     * OSS人脸识别头像存储的桶名
     */
    public static String SAVE_FACE_IMG_OSS_BUCKET_NAME;
    /**
     * 鉴权秘钥
     */
    public static String SECRET;

    /**
     * 高德地址翻译开关
     */
    public static Boolean GD_MAP_SWITCH;
    /**
     * 高德地址翻译key
     */
    public static String GD_MAP_KEY;

    public void refresh() {
        System.out.println("刷新配置，触发创建新实例对象");
    }

    @Value("${tbit-system.GD_MAP_SWITCH}")
    public void initGdMapSwitch(Boolean s) {
        GD_MAP_SWITCH = s;
    }

    @Value("${tbit-system.GD_MAP_KEY}")
    public void initGdMapKey(String s) {
        GD_MAP_KEY = s;
    }

    @Value("${tbit-system.virtual}")
    public void initApppath(String s) {
        virtual = s;
    }

    @Value("${tbit-system.operaPsw}")
    public void initWeixinpath(String s) {
        operaPsw = s;
    }

    @Value("${tbit-system.angleNum}")
    public void initFilenameUrl(String s) {
        angleNum = s;
    }

    @Value("${tbit-system.BLE_KEY}")
    public void initBleKey(String s) {
        BLE_KEY = s;
    }

    @Value("${tbit-system.PUSH_BUTTON}")
    public void initPushButton(String s) {
        PUSH_BUTTON = s;
    }

    @Value("${tbit-system.PUSH_URL}")
    public void initPushUrl(String s) {
        PUSH_URL = s;
    }

    @Value("${tbit-system.FACE_URL}")
    public void initFaceUrl(String s) {
        FACE_URL = s;
    }

    @Value("${tbit-system.PHOTO_PATH}")
    public void initPhoto_path(String s) {
        PHOTO_PATH = s;
    }

    @Value("${tbit-system.SUPER_PASSWORD_AUTH_SECRET}")
    public void initSuperPasswordAuthSecret(String s) {
        SUPER_PASSWORD_AUTH_SECRET = s;
    }

    @Value("${tbit-system.SUPER_PASSWORD_AUTH_DIGITS}")
    public void initSuperPasswordAuthDigits(String s) {
        SUPER_PASSWORD_AUTH_DIGITS = s;
    }

    @Value("${tbit-system.SUPER_PASSWORD_AUTH_EXPIRE}")
    public void initSuperPasswordAuthExpire(String s) {
        SUPER_PASSWORD_AUTH_EXPIRE = s;
    }

    @Value("${tbit-system.AUTH_CODE_LENGTH}")
    public void initAuthCodeLength(Integer length) {
        AUTH_CODE_LENGTH = length;
    }

    @Value("${tbit-system.AUTH_CODE_VALIDITY}")
    public void initAuthCodeValidity(Integer validity) {
        AUTH_CODE_VALIDITY = validity;
    }

    @Value("${tbit-system.SUPER_PASSWORD_AUTH_SECRET_PLUS}")
    public void initSuperPasswordAuthSecretPlus(String s) {
        SUPER_PASSWORD_AUTH_SECRET_PLUS = s;
    }

    @Value("${tbit-system.SUPER_PASSWORD_AUTH_DIGITS_PLUS}")
    public void initSuperPasswordAuthDigitsPlus(String s) {
        SUPER_PASSWORD_AUTH_DIGITS_PLUS = s;
    }

    @Value("${tbit-system.SUPER_PASSWORD_AUTH_EXPIRE_PLUS}")
    public void initSuperPasswordAuthExpirePlus(String s) {
        SUPER_PASSWORD_AUTH_EXPIRE_PLUS = s;
    }

    @Value("${tbit-system.MAAS_SECRET}")
    public void initMaasSecret(String s) {
        MAAS_SECRET = s;
    }

    @Value("${tbit-system.CASH_SERVICE_URL}")
    public void initCashServiceUrl(String s) {
        CASH_SERVICE_URL = s;
    }

    @Value("${tbit-system.borrow_button}")
    public void initborrow_button(boolean s) {
        borrow_button = s;
    }

    @Value("${tbit-system.login_button}")
    public void initlogin_button(boolean s) {
        login_button = s;
    }

    @Value("${tbit-system.ENDPOINT}")
    public void initEndpoint(String s) {
        ENDPOINT = s;
    }

    @Value("${tbit-system.ACCESSKEYID}")
    public void initAccessKeyId(String s) {
        ACCESSKEYID = s;
    }

    @Value("${tbit-system.ACCESSKEYSECRET}")
    public void initAccesskeysecret(String s) {
        ACCESSKEYSECRET = s;
    }

    @Value("${tbit-system.FACEBUCKETNAME}")
    public void initFacebucketname(String s) {
        FACEBUCKETNAME = s;
    }

    @Value("${tbit-system.SAVEFACEIMGOSSBUCKETNAME:gx-face-log}")
    public void initSaveFaceImgOSSBucketName(String s) {
        SAVE_FACE_IMG_OSS_BUCKET_NAME = s;
    }

    @Value("${tbit-system.SECRET:abc}")
    public void initSecret(String s) {
        SECRET = s;
    }
}
